package model

import "fmt"

type Account struct {
	account  string
	balance  float64
	password string
}

func NewAccount(a string, b float64, p string) *Account {
	return &Account{a, b, p}
}

func (account *Account) SetFiled(a string, balance float64, password string) {
	// 账户校验
	if len(a) >= 6 && len(a) <= 20 {
		account.account = a
	} else {
		fmt.Println("账户长度介于6和20位之间")
	}

	// 余额校验
	if balance < 20.00 {
		fmt.Println("账户余额必须大于20.00元")
	} else {
		account.balance = balance
	}

	// 密码校验
	if len(password) != 6 {
		fmt.Println("密码长度必须是6位数")
	} else {
		account.password = password
	}
}
